import type { RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/index.vue'
// 对外暴露配置路由（常量路由）
export const constantRoute: RouteRecordRaw[] = [
  {
    // 登录
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    name: 'login', // 命名路由
    meta: {
      title: '登录',
      hidden: true,
      icon: 'Comment',
    },
  },
  {
    // 404
    path: '/404',
    component: () => import('@/views/404/index.vue'),
    name: '404', // 命名路由
    meta: {
      title: '404',
      hidden: true,
      icon: 'Operation',
    },
  },
  {
    path: '',
    component: Layout,
    redirect: 'home',
    meta: { hidden: false, always: false },
    children: [
      {
        path: '/home',
        component: () => import('@/views/home/index.vue'),
        name: 'Home',
        meta: { title: '首页', icon: 'Promotion', hidden: false },
      },
    ],
  },
  {
    path: '/screen',
    component: () => import('@/views/screen/index.vue'),
    name: 'Screen', // 命名路由
    meta: {
      title: '数据大屏',
      hidden: false,
      icon: 'Platform',
    },
  },
  {
    path: '/time',
    component: () => import('@/views/time/index.vue'),
    name: 'Time', // 命名路由
    meta: {
      title: '展示时间',
      hidden: false,
      icon: 'Timer',
    },
  },
  {
    path: '/three',
    component: () => import('@/views/three/index.vue'),
    name: 'Three', // 命名路由
    meta: {
      title: 'Three',
      hidden: false,
      icon: 'Timer',
    },
  },
  {
    path: '/island',
    component: () => import('@/views/three/island.vue'),
    name: 'Island', // 命名路由
    meta: {
      title: 'Island',
      hidden: false,
      icon: 'Timer',
    },
  },
]

// 异步路由
export const dynamicRoutes = [
  {
    path: '/acl',
    component: Layout,
    name: 'Acl', // 命名路由
    meta: {
      title: '权限管理',
      hidden: false,
      icon: 'Lock',
      always: true,
      permissionID: '123',
    },
    children: [
      {
        path: '/user',
        component: () => import('@/views/acl/user/index.vue'),
        name: 'User',
        meta: {
          title: '用户管理',
          hidden: false,
          icon: 'User',
        },
      },
      {
        path: '/rule',
        component: () => import('@/views/acl/rule/index.vue'),
        name: 'Rule',
        meta: {
          title: '角色管理',
          hidden: false,
          icon: 'UserFilled',
        },
      },
      {
        path: '/permission',
        component: () => import('@/views/acl/permission/index.vue'),
        name: 'Permission',
        meta: {
          title: '菜单管理',
          hidden: false,
          icon: 'Grid',
        },
      },
    ],
  },
  {
    path: '/product',
    component: Layout,
    name: 'Product', // 命名路由
    meta: {
      title: '商品管理',
      hidden: false,
      icon: 'ShoppingBag',
      always: true,
    },
    children: [
      {
        path: '/trademark',
        component: () => import('@/views/product/trademark/index.vue'),
        name: 'Trademark',
        meta: {
          title: '品牌管理',
          hidden: false,
          icon: 'ShoppingCart',
        },
      },
      {
        path: '/attr',
        component: () => import('@/views/product/attr/index.vue'),
        name: 'Attr',
        meta: {
          title: '属性管理',
          hidden: false,
          icon: 'Avatar',
        },
      },
      {
        path: '/spu',
        component: () => import('@/views/product/spu/index.vue'),
        name: 'Spu',
        meta: {
          title: 'SPU管理',
          hidden: false,
          icon: 'PartlyCloudy',
        },
      },
      {
        path: '/sku',
        component: () => import('@/views/product/sku/index.vue'),
        name: 'Sku',
        meta: {
          title: 'SKU管理',
          hidden: false,
          icon: 'Sunset',
        },
      },
    ],
  },
]

// 任意路由
export const anyRoute = [
  {
    // 任意路由
    path: '/:pathMatch(.*)*',
    redirect: '/404',
    name: 'Any',
    meta: {
      title: 'Any',
      hidden: true,
      icon: 'FullScreen',
    },
  },
]
